import React from 'react';
import {
  Form,
  Modal,
} from 'antd';

import DescriptionList from '@/components/DescriptionList';

const { Description } = DescriptionList;

// 查看详情
const DescView = Form.create()(props => {
  const { lookDescView, handleLookDesc, selectedRows } = props;
  const status = (status) => {
    let str = '';
    if (status === 1) {
      str = 'android';
    } else {
      str = status === 2 ? 'ios' : '全部';
    }
    return str;
  };
  return (
    <Modal
      width={640}

      destroyOnClose
      title="查看详情"
      visible={lookDescView}
      onOk={() => handleLookDesc(false, [])}
      onCancel={() => handleLookDesc(false, [])}>
      <DescriptionList size="large" style={{ marginBottom: 32 }} col="2">
        <Description term="公告编号">{selectedRows.noticeNo}</Description>
        <Description term="标题">{selectedRows.title}</Description>
        <Description term="副标题">{selectedRows.subTitle}</Description>
        <Description term="推送">{selectedRows.push === 1 ? '是' : '否'}</Description>
        <Description term="发布范围">{status(selectedRows.status)}</Description>
        <Description term="首页通知">{selectedRows.frontShow === 1 ? '是' : '否'}</Description>
        <Description term="状态">{selectedRows.status === 1 ? '上架' : '下架'}</Description>
        <Description term="创建人">{selectedRows.createName}</Description>
        <Description term="创建时间">{selectedRows.createTime}</Description>
        <Description term="上架时间">{selectedRows.upTime}</Description>
      </DescriptionList>
      <Description term="内容">
        <div dangerouslySetInnerHTML={{ __html: selectedRows.content }}></div>
      </Description>
    </Modal>
  );
});

export default DescView;
